/*
 *  Copyright 2010 UPF Telecos 4th group G.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

package edu.upf.content;

import edu.upf.utils.Definitions;
import java.awt.Image;
import java.io.Serializable;
import javax.swing.ImageIcon;

/**
 * This class models a video with an id and a list of keywords
 * @author netjois
 */
public class Video implements Serializable, Definitions, DescriptionContent {

    private String name;
    private String size;
    private String path;
    private String popularity;
    private String owner;
    private ImageIcon thumbnail;

    public Video() {
        thumbnail=new ImageIcon(getClass().getResource("/video_default_thumb.png"));
    }

    @Override
    public void setName(String n) {
        name = n;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setSize(String s) {
        size = s;
    }

    @Override
    public String getSize() {
        return size;
    }

    @Override
    public void setPath(String p) {
        path = p;
    }

    @Override
    public String getPath() {
        return path;
    }

    @Override
    public void setPopularity(String p) {
        popularity = p;
    }

    @Override
    public String getPopularity() {
        return popularity;
    }

    @Override
    public void setOwner(String owner) {
        this.owner = owner;
    }

    @Override
    public String getOwner() {
        return owner;
    }

    @Override
    public ImageIcon getThumbnail(){
        return thumbnail;
    }

    /**
     * Sets the thumbnail with the given ImageIcon
     * @param originalImage
     */
    public void setThumbnail(ImageIcon originalImage){
        Image img = originalImage.getImage();
        Image scaledImg = img.getScaledInstance(THUMBHEIGHT, THUMBWIDTH,
                java.awt.Image.SCALE_SMOOTH);
        this.thumbnail = new ImageIcon(scaledImg);
    }
}


